﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Scripting.Ast;

namespace Scala.Compiler.Ast
{
    public class MemberExpression:Expression
    {
        private readonly Expression _target;
        private readonly string _name;

        public MemberExpression(Expression target, string name)
        {
            _target = target;
            _name = name;
        }

        public Expression Target
        {
            get { return _target; }
        }

        public string Name
        {
            get { return _name; }
        }

        public override string ToString()
        {
            return base.ToString() + ":" + _name;
        }

        public override void Walk(ScalaWalker walker)
        {
            if (walker.Walk(this))
            {
                if (_target != null)
                {
                    _target.Walk(walker);
                }
            }
            walker.PostWalk(this);
        }

        public override Microsoft.Scripting.Ast.Expression Reduce()
        {
            throw new NotImplementedException();
        }
    }
}
